﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Principal.Master" AutoEventWireup="true" CodeBehind="AsignacionServicio.aspx.cs" Inherits="ProyectoSalvadorDelMundo.Asambleas.AsignacionServicios.AsignacionServicio" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<asp:Content ID="Content2" ContentPlaceHolderID="contenidoPrincipal" runat="server">
        <form id="form1" runat="server">
            <ajax:ToolkitScriptManager ID="toolkitdcriptmanager" runat="server" EnablePartialRendering="true">
            </ajax:ToolkitScriptManager>
            <ul class="breadcrumb">
                <li>
                    <asp:HyperLink ID="linkNav" runat="server"></asp:HyperLink>
                    <span class="divider">/</span>
                </li>
                <li>
                    <asp:Label ID="lblNavActiva" runat="server"></asp:Label>
                </li>
            </ul>
            <div>
                <div>
                    <h3>
                        <asp:Label ID="lblTitulo" runat="server"></asp:Label></h3>
                </div>
                <div class="contentDiv">
                    <div class="gridWrapper">
                        <ajax:TabContainer ID="tbControl" runat="server">
                            <ajax:TabPanel runat="server" ID="tbAsamblea">
                                <HeaderTemplate>
                                    Asamblea
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <asp:UpdatePanel ID="udpAsamblea" runat="server" UpdateMode="Conditional">

                                        <ContentTemplate>
                                            <asp:Label ID="lbl" runat="server" Text="Seleccione Asamblea" AssociatedControlID="ddl"></asp:Label>
                                            <asp:DropDownList ID="ddl" runat="server" OnSelectedIndexChanged="ddl_SelectedIndexChanged" CausesValidation="False" AutoPostBack="True"></asp:DropDownList>
                                            <asp:DropDownList ID="ddlFechas" runat="server" OnSelectedIndexChanged="ddlFechas_SelectedIndexChanged" CausesValidation="False" AutoPostBack="True"></asp:DropDownList>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                    <asp:UpdateProgress ID="updateprogress1" runat="server">
                                        <ProgressTemplate>
                                            <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999998; background-color: #000000; opacity: 0.7;">
                                                <span style="border-width: 0px; position: fixed; padding: 50px; background-color: #FFFFFF; font-size: 20px; left: 40%; top: 40%;">Cargando ...</span>
                                            </div>
                                        </ProgressTemplate>
                                    </asp:UpdateProgress>
                                </ContentTemplate>
                            </ajax:TabPanel>
                            <ajax:TabPanel runat="server" ID="tbServicios">
                                <HeaderTemplate>
                                    Servicios Manuales
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <div class="gridContainer">
                                        <asp:UpdatePanel ID="udpServicios" runat="server" UpdateMode="Conditional">
                                            <ContentTemplate>
                                                
                                                <h5><asp:Label ID="lblAsambleaActualA" Font-Bold="true" runat="server" Text=""></asp:Label></h5>
                                                <br />
                                                <asp:Label ID="lblGruposServicios" runat="server" Text="Seleccione Grupo" AssociatedControlID="ddlGrupoServicios"></asp:Label>
                                                <asp:DropDownList ID="ddlGrupoServicios" runat="server" OnSelectedIndexChanged="ddlGrupoServicios_SelectedIndexChanged" CausesValidation="False" AutoPostBack="True"></asp:DropDownList>
                                                <div class="input-group">
                                                    <div class="input-group-btn">
                                                        <asp:ImageButton ID="btnBuscarServicio" runat="server" OnClick="BuscarServicio" />
                                                    </div>
                                                    <asp:TextBox ID="txtBuscarServicio" runat="server" />
                                                </div>

                                                <asp:ListView ID="lsvListaServicio" runat="server" GroupPlaceholderID="groupPlaceHolder1" ItemPlaceholderID="itemPlaceHolder1" OnPagePropertiesChanging="OnPagePropertiesChangingServicio">
                                                    <LayoutTemplate>
                                                        <table class="table table-striped table-bordered table-condensed table-hover">
                                                            <tr>
                                                                <th style="width: 0px; display: none">ID
                                                                </th>
                                                                <th>Servicio
                                                                </th>
                                                                <th style="width: 0px; display: none">ID
                                                                </th>
                                                                <th>Servidor Asignado
                                                                </th>
                                                                <th>Asignar
                                                                </th>
                                                            </tr>
                                                            <asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
                                                            <tr>
                                                                <td colspan="4">
                                                                    <asp:DataPager ID="DataPager1" runat="server" PageSize="10" PagedControlID="lsvListaServicio">
                                                                        <Fields>
                                                                            <asp:NextPreviousPagerField ButtonType="Link" FirstPageText="Primero" ShowFirstPageButton="true" PreviousPageText="Anterior" ShowPreviousPageButton="true" ShowNextPageButton="false" ShowLastPageButton="false" ButtonCssClass="navbar-link" />

                                                                            <asp:NumericPagerField ButtonType="Link" NumericButtonCssClass="navbar-link" />

                                                                            <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="false" ShowPreviousPageButton="false" NextPageText="Siguiente" ShowNextPageButton="true" LastPageText="Ultimo" ShowLastPageButton="true" ButtonCssClass="navbar-link" />
                                                                        </Fields>
                                                                    </asp:DataPager>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </LayoutTemplate>
                                                    <GroupTemplate>
                                                        <tr>
                                                            <asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
                                                        </tr>
                                                    </GroupTemplate>
                                                    <EmptyDataTemplate>
                                                        <table runat="server" style="">
                                                            <tr>
                                                                <td>No se encontraron datos.</td>
                                                            </tr>
                                                        </table>
                                                    </EmptyDataTemplate>
                                                    <ItemTemplate>
                                                        <td style="width: 0px; display: none">
                                                            <asp:Label ID="ID" runat="server" Text='<%# Eval ("id_servicio") %>'></asp:Label>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="NOMBRE" runat="server" Text='<%# Eval ("nombre") %>'></asp:Label>
                                                        </td>
                                                        <td style="width: 0px; display: none">
                                                            <asp:Label ID="ID_Servidor" runat="server" Text='<%# Eval ("id_servidor") %>'></asp:Label>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="Nombre_Servidor" runat="server" Text='<%# Eval ("nombre_servidor") %>'></asp:Label>
                                                        </td>
                                                        <td style="width: 100px">
                                                            <asp:LinkButton ID="linEditar" runat="server" OnClick="EditarServicio" CausesValidation="false">Asignar</asp:LinkButton>
                                                        </td>
                                                    </ItemTemplate>
                                                </asp:ListView>
                                                <asp:Panel ID="pnlAgregarEditarServicio" runat="server">
                                                    <div class="modal-content  ">
                                                        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                                <div class="modal-header">
                                                                    <asp:Button ID="btnPopXServicio" runat="server" CausesValidation="false" OnClick="CerrarPopServicio" />
                                                                    <h4>
                                                                        <asp:Label ID="lblPopupTituloServicio" runat="server"></asp:Label>

                                                                    </h4>
                                                                </div>

                                                                <div class="modal-body">
                                                                    <div class="form-horizontal">
                                                                        <div class="form-group">
                                                                            <div class="col-sm-12">
                                                                                <asp:TextBox ID="txtIdServicio" runat="server" Style="width: 0px; display: none"></asp:TextBox>
                                                                                <asp:Label ID="lblAccionServicio" runat="server"></asp:Label>
                                                                            </div>
                                                                        </div>

                                                                        <div class="form-group">
                                                                            <asp:Label ID="lblNombreServicio" runat="server"></asp:Label>
                                                                            <div class="col-sm-10">
                                                                                <asp:TextBox ID="txtNombreServicio" runat="server"></asp:TextBox>
                                                                            </div>

                                                                        </div>
                                                                        <div class="form-group">
                                                                            <asp:Label ID="lblServidor" runat="server"></asp:Label>
                                                                            <div class="col-sm-10">
                                                                                <asp:DropDownList ID="ddlServidor" runat="server" CausesValidation="False" AutoPostBack="False"></asp:DropDownList>
                                                                            </div>
                                                                        </div>
                                                                        <div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="modal-footer">
                                                                    <asp:Button ID="btnPopCerrarServicio" runat="server" CausesValidation="false" OnClick="CerrarPopServicio" />
                                                                    <asp:Button ID="btnPopGuardarServicio" runat="server" OnClick="GuardarServicio" />
                                                                </div>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                    </div>
                                                </asp:Panel>
                                                <asp:LinkButton ID="lnkFalsoServicio" runat="server"></asp:LinkButton>
                                                <ajax:ModalPopupExtender ID="popupServicio" runat="server" DropShadow="False"
                                                    PopupControlID="pnlAgregarEditarServicio" TargetControlID="lnkFalsoServicio"
                                                    BackgroundCssClass="modalBackground">
                                                </ajax:ModalPopupExtender>
                                                </span>
                                            </ContentTemplate>
                                            <Triggers>
                                                <asp:AsyncPostBackTrigger ControlID="lsvListaServicio" />
                                                <asp:AsyncPostBackTrigger ControlID="btnPopGuardarServicio" />
                                                <asp:AsyncPostBackTrigger ControlID="btnBuscarServicio" />
                                            </Triggers>
                                        </asp:UpdatePanel>
                                        <asp:UpdateProgress ID="updateprogressServicios" runat="server">
                                            <ProgressTemplate>
                                                <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999998; background-color: #000000; opacity: 0.7;">
                                                    <span style="border-width: 0px; position: fixed; padding: 50px; background-color: #FFFFFF; font-size: 20px; left: 40%; top: 40%;">Cargando ...</span>
                                                </div>
                                            </ProgressTemplate>
                                        </asp:UpdateProgress>
                                    </div>
                                </ContentTemplate>
                            </ajax:TabPanel>
                            <ajax:TabPanel runat="server" ID="tbAutoServicios">
                                <HeaderTemplate>
                                    Servicios Automaticos
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <div class="gridContainer" runat="server" id="divAutoServicio">
                                        <asp:UpdatePanel ID="udpAutoServicio" runat="server" UpdateMode="Conditional">
                                            <ContentTemplate>
                                                <h5><asp:Label ID="lblAsambleaActualB" Font-Bold="true" runat="server" Text=""></asp:Label></h5>
                                                <br />
                                                <asp:Label ID="Label2" runat="server" Text="Seleccione Grupo" AssociatedControlID="ddlGruposAutoServicio"></asp:Label>
                                                <asp:DropDownList ID="ddlGruposAutoServicio" runat="server" OnSelectedIndexChanged="ddlGruposAutoServicio_SelectedIndexChanged" CausesValidation="False" AutoPostBack="True"></asp:DropDownList>
                                                <div class="input-group">
                                                    <div class="input-group-btn">
                                                        <asp:ImageButton ID="btnBuscarAutoServicio" runat="server" OnClick="BuscarAutoServicio" />
                                                    </div>
                                                    <asp:TextBox ID="txtBuscarAutoServicio" runat="server" />
                                                </div>
                                                <asp:Button ID="btnAsignar" runat="server" CausesValidation="false" OnClick="AsignarAutoServicios" Text="Asignar Automaticamente" />
                                                <asp:Button ID="btnReporte" runat="server" CausesValidation="false" OnClick="MostrarReporte" Text="Mostrar Reporte" />
                                                <asp:ListView ID="lsvListaAutoServicio" runat="server" GroupPlaceholderID="groupPlaceHolder1" ItemPlaceholderID="itemPlaceHolder1" OnPagePropertiesChanging="OnPagePropertiesChangingAutoServicio">
                                                    <LayoutTemplate>
                                                        <table class="table table-striped table-bordered table-condensed table-hover">
                                                            <tr>
                                                                <th style="width: 0px; display: none">ID
                                                                </th>
                                                                <th>Servicio
                                                                </th>
                                                                <th style="width: 0px; display: none">ID
                                                                </th>
                                                                <th>Servidor Asignado
                                                                </th>
                                                                <th>Asignar
                                                                </th>
                                                            </tr>
                                                            <asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
                                                            <tr>
                                                                <td colspan="4">
                                                                    <asp:DataPager ID="DataPager1" runat="server" PageSize="10" PagedControlID="lsvListaAutoServicio">
                                                                        <Fields>
                                                                            <asp:NextPreviousPagerField ButtonType="Link" FirstPageText="Primero" ShowFirstPageButton="true" PreviousPageText="Anterior" ShowPreviousPageButton="true" ShowNextPageButton="false" ShowLastPageButton="false" ButtonCssClass="navbar-link" />

                                                                            <asp:NumericPagerField ButtonType="Link" NumericButtonCssClass="navbar-link" />

                                                                            <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="false" ShowPreviousPageButton="false" NextPageText="Siguiente" ShowNextPageButton="true" LastPageText="Ultimo" ShowLastPageButton="true" ButtonCssClass="navbar-link" />
                                                                        </Fields>
                                                                    </asp:DataPager>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </LayoutTemplate>
                                                    <GroupTemplate>
                                                        <tr>
                                                            <asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
                                                        </tr>
                                                    </GroupTemplate>
                                                    <EmptyDataTemplate>
                                                        <table runat="server" style="">
                                                            <tr>
                                                                <td>No se encontraron datos.</td>
                                                            </tr>
                                                        </table>
                                                    </EmptyDataTemplate>
                                                    <ItemTemplate>
                                                        <td style="width: 0px; display: none">
                                                            <asp:Label ID="ID" runat="server" Text='<%# Eval ("id_servicio") %>'></asp:Label>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="NOMBRE" runat="server" Text='<%# Eval ("nombre") %>'></asp:Label>
                                                        </td>
                                                        <td style="width: 0px; display: none">
                                                            <asp:Label ID="ID_Servidor" runat="server" Text='<%# Eval ("id_servidor") %>'></asp:Label>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="Nombre_Servidor" runat="server" Text='<%# Eval ("nombre_servidor") %>'></asp:Label>
                                                        </td>
                                                        <td style="width: 100px">
                                                            <asp:LinkButton ID="linEditar" runat="server" OnClick="EditarAutoServicio" CausesValidation="false">Asignar</asp:LinkButton>
                                                        </td>
                                                    </ItemTemplate>
                                                </asp:ListView>
                                                
                                                <asp:Panel ID="pnlAgregarEditarAutoServicio" runat="server">
                                                    <div class="modal-content  ">
                                                        <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                                <div class="modal-header">
                                                                    <asp:Button ID="btnPopXAutoServicio" runat="server" CausesValidation="false" OnClick="CerrarPopAutoServicio" />
                                                                    <h4>
                                                                        <asp:Label ID="lblPopupTituloAutoServicio" runat="server"></asp:Label></h4>
                                                                </div>

                                                                <div class="modal-body">
                                                                    <div class="form-horizontal">
                                                                        <div class="form-group">
                                                                            <div class="col-sm-12">
                                                                                <asp:TextBox ID="txtIdAutoServicio" runat="server" Style="width: 0px; display: none"></asp:TextBox>
                                                                                <asp:Label ID="lblAccionAutoServicio" runat="server"></asp:Label>
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <asp:Label ID="lblNombreAutoServicio" runat="server"></asp:Label>
                                                                            <div class="col-sm-10">
                                                                                <asp:TextBox ID="txtNombreAutoServicio" runat="server"></asp:TextBox>
                                                                            </div>

                                                                        </div>
                                                                        <div class="form-group">
                                                                            <asp:Label ID="lblAutoServidor" runat="server"></asp:Label>
                                                                            <div class="col-sm-10">
                                                                                <asp:DropDownList ID="ddlAutoServidor" runat="server" CausesValidation="False" AutoPostBack="False"></asp:DropDownList>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="modal-footer">
                                                                    <asp:Button ID="btnPopCerrarAutoServicio" runat="server" CausesValidation="false" OnClick="CerrarPopAutoServicio" />
                                                                    <asp:Button ID="btnPopGuardarAutoServicio" runat="server" OnClick="GuardarAutoServicio" />
                                                                </div>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                    </div>
                                                </asp:Panel>
                                                <asp:LinkButton ID="lnkFalsoAutoServicio" runat="server"></asp:LinkButton>
                                                <ajax:ModalPopupExtender ID="popupAutoServicio" runat="server" DropShadow="False"
                                                    PopupControlID="pnlAgregarEditarAutoServicio" TargetControlID="lnkFalsoAutoServicio"
                                                    BackgroundCssClass="modalBackground">
                                                </ajax:ModalPopupExtender>
                                                </span>
                                            </ContentTemplate>
                                            <Triggers>
                                                <asp:AsyncPostBackTrigger ControlID="lsvListaAutoServicio" />
                                                <asp:AsyncPostBackTrigger ControlID="btnPopGuardarAutoServicio" />
                                                <asp:AsyncPostBackTrigger ControlID="btnBuscarAutoServicio" />
                                            </Triggers>
                                        </asp:UpdatePanel>
                                        <asp:UpdateProgress ID="updateprogressAutoServicio" runat="server">
                                            <ProgressTemplate>
                                                <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999998; background-color: #000000; opacity: 0.7;">
                                                    <span style="border-width: 0px; position: fixed; padding: 50px; background-color: #FFFFFF; font-size: 20px; left: 40%; top: 40%;">Cargando ...</span>
                                                </div>
                                            </ProgressTemplate>
                                        </asp:UpdateProgress>
                                    </div>
                                </ContentTemplate>
                            </ajax:TabPanel>
                        </ajax:TabContainer>
                    </div>
                </div>
            </div>
    </form>
</asp:Content>
